package com.tinama.jedis01.queue;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

/**
 * @author lgc
 * @createDate 2020/10/14 - 9:38
 */
public class Blocking {
    private static BlockingQueue<String> blockingQueue = new ArrayBlockingQueue(3);
    public static void putString(String str){
        try {
            blockingQueue.put(str);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    public static void takeString(){
        try {
            System.out.println(blockingQueue.take());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
